package com.qwz.learn;


/**
* @Description: 具体的命令实现对象
* @Package com.qwz.learn.ConcreteCommand
* @author Qiuwuzhi
* @date 2019/12/26 11:15
* @version V1.0
*/
public class ConcreteCommand implements Command {
    /**
     * 持有相应接受者对象
     */
    private Receiver receiver;
    /**
     * 命令对象可以有自己的状态
     */
    private String state;

    public ConcreteCommand(Receiver receiver) {
        this.receiver = receiver;
    }

    public void execute() {
        //通常会转调接收者对象的相应方法，让接收者来真正执行功能
        receiver.action();
    }
}
